{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Notebook for preparing and saving CIFAR graphs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import torch\n",
    "import pickle\n",
    "import time\n",
    "import os\n",
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Download CIFAR dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "File already downloaded\n"
     ]
    }
   ],
   "source": [
    "if not os.path.isfile('superpixels.zip'):\n",
    "    print('downloading..')\n",
    "    !curl https://www.dropbox.com/s/y2qwa77a0fxem47/superpixels.zip?dl=1 -o superpixels.zip -J -L -k\n",
    "    !unzip superpixels.zip -d ../\n",
    "    # !tar -xvf superpixels.zip -C ../\n",
    "else:\n",
    "    print('File already downloaded')\n",
    "    "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Convert to DGL format and save with pickle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Users/xbresson/Documents/Dropbox/06_NTU_2017_now/03_my_codes/34_benchmark20/GITHUB_benchmark_project/benchmarking-gnn\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "os.chdir('../../') # go to root folder of the project\n",
    "print(os.getcwd())\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pickle\n",
    "\n",
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "\n",
    "from data.superpixels import SuperPixDatasetDGL \n",
    "\n",
    "from data.data import LoadData\n",
    "from torch.utils.data import DataLoader\n",
    "from data.superpixels import SuperPixDataset\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Adj matrix defined from super-pixel locations (only)\n",
      "preparing 10000 graphs for the TEST set...\n",
      "preparing 50000 graphs for the TRAIN set...\n",
      "[I] Data load time: 639.9484s\n",
      "Time (sec): 639.9550220966339\n"
     ]
    }
   ],
   "source": [
    "start = time.time()\n",
    "\n",
    "DATASET_NAME = 'CIFAR10'\n",
    "dataset = SuperPixDatasetDGL(DATASET_NAME) \n",
    "\n",
    "print('Time (sec):',time.time() - start) # 636s=10min\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEICAYAAABfz4NwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAWbUlEQVR4nO3dfZCd5Xnf8e+vUq2AbWFeFixLSlaxNa5BkzSgIbSZcT1DElRwEW5MR65t1FitYgbXTmuPLUobe9qqhaQtDdOAQ4AiXApWSVKUEmwTUYd2yovXGCwEpqyDjBZktLGxjeNaRfLVP86tclidXUnnLPtifT8zZ85zrvu5z15nEfvb536eczZVhSRJf2m2G5AkzQ0GgiQJMBAkSY2BIEkCDARJUmMgSJIAA0HqW5JPJ/lns92HNF3i+xB0rEqyC/j7VfUns93LZOZDj/rx4RGC1EOShbPdgzTTDAQdk5J8BvhJ4I+SfD/Jx5NUkg1JngHubfv9lyTfTPLdJPclOaPrOW5O8i/b9juSjCX5aJK9SfYk+dWufc9P8niSF5M8m+RjXWPvTPJIku8k+V9JfmayHmfkm6NjloGgY1JVvR94BvhbVfU6YGsb+hvA24Dz2uO7gZXAqcDDwK1TPO0bgROApcAG4HeSnNjGbgR+rapeD6zi5cA5E7g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ME8Brw9yclJjgfOp/MbyGlVtQeg3Z86iz0ezmS99vo4kaUz3Fu/5lvvHwDubtvzovckm5PsBt4L/EYrz+nek1wIPFtVj04YmtN9d/lQW6q7qWtpd1p7NxAGUFVP0Dncvwf4HJ1Dt/1TTpo/jujjROaoedN7kivo/Ju59WCpx25zrvequqKqltPp+0OtPGd7b7+wXcHL4fWK4R61OdF3l+uANwN/FdgD/NtWn9beDYQBVdWNVXVmVb2dzmHeU8DzSZYAtPu9s9njYUzW63z+OJF50XuS9cA7gfdWWxBmnvTe5T8Dv9K253Lvb6azxv5okl10ens4yRuZ230DUFXPV9WBqvoR8Hu8vCw0rb0bCANKcmq7/0ngbwO30fnYjfVtl/XAnbPT3RGZrNdtwLoki5KsoHOy/KFZ6K8fc7739gehPgFcWFU/6BqaD72v7Hp4IfC1tj1ne6+qHVV1alUNV9UwnR+kZ1bVN5nDfR908Je25l10lqthunufrTPpPy434H/Q+bsNjwLnttrJwHY6RwvbgZNmu8/W1210DjdfovM/xIapeqVziP114Engb87B3t/VtvcBzwOfn0e9j9JZ+32k3T49j3r/fTo/kL4K/BGwdK713qvvCeO7aFcZzaW+p/iefwbY0b7n24Alr0bvfnSFJAlwyUiS1BgIkiTAQJAkNQaCJAkwECRJjYEgSQIMBElS8/8AXt40LvVVNmEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "nb/min/max : 45000 85 150\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAEICAYAAACzliQjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAATlUlEQVR4nO3df6zd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HmOwZweT/LXWCbzNfQXzx5gc1vfDNw7VN+UZGWSdcB64NGzML6ltGzn3P4RoA8BN1XVD4aalvOc1w+9vQn4ZltfdnOuqier6pKqWltVaxkE/VVV9R2Wy3zP9jfJ5+ILuAc4Avwlg/8pbgX+KrAXeKYtLxrqfzuDb/oPADec7fEv4px/va0fA14CvtzBnA8yuK779fb6VAdz/iLwFPAN4N8Dq5bLnEfNd177c7S7d5bDfKvKxzBIUk+8vCNJHTH0Jakjhr4kdcTQl6SOGPqS1BFDX5I6YuhLUkf+P9KKFmHSS6EbAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "nb/min/max : 5000 95 145\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEICAYAAABYoZ8gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAQKUlEQVR4nO3df6zddX3H8efLMhkymbC2rLad7UyjAtmYdojRbCxM6UQpxjBr/FEytk6H2ZboXJFlblma4ZbNxGzgaiRWpzRNnKMGUVn3wxmdcCH8KtDQSbW1ta1DA86kkfLeH/fDOL2c29ve255b+nk+kpPzPe/vj/M577av++3nfM+5qSokSf14zmwPQJI0Wga/JHXG4Jekzhj8ktQZg1+SOmPwS1JnDH5J6ozBr64k2ZHk12d4jCuTfPVEGY90tAx+SeqMwa9uJPkU8HPA55P8MMn7k1yY5GtJfpDkniQXDWx/ZZJvJnk8ySNJ3pbkZcBHgVe1Y/ygbfv6JA+0bb+T5H0Dx3lDkrvbc3wtyS9MNp4RtkMdi1/ZoJ4k2QH8dlX9S5KFwL3AO4AvAhcDG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E1MWU1hGyF4eyH0+zF4eaUT9S9YwpdknSScyvbJCkzhj8ktQZg/84SnJjkn1J7h+onZXktiQPt/szB9Zd077KYluSS2Zn1MfPJP24IsnWJE8mWT5h+5O2H5P04q+TPJTk3iSfS/KCgXUnbS9g0n78RevF3Um+nOSFA+u668fAuvclqSRzB2pH14+q8nacbsCvAC8H7h+o/RWwti2vBT7Uls8B7gFOBZYC/w3Mme3XMIJ+vAx4CfDvwPKB+kndj0l68TrglLb8If9ucMbA8u8DH+25H62+mPGLY74FzJ1uPzzjP46q6ivAoxPKK4ENbXkDcPlAfWNVHaiqR4DtjH/FxUljWD+q6sGqGvbJ7JO6H5P04stV9UR7+F+Mf84FTvJewKT9eGzg4ek8/WHPLvvRfBh4P4d+8PWo+2Hwj97ZVbUHoN3Pb/VhX2excMRjO5H03o/fAm5ty932Ism6JDuBtwF/2spd9iPJZcB3quqeCauOuh8G/4njiL7OoiPd9iPJtcATwKefKg3ZrIteVNW1VbWY8V68p5W760eS5wHX8vQPv0NWD6kdth8G/+jtTbIAoN3va3W/zuJQXfYjyWrgDcDbqk3g0mkvJvgM8Oa23GM/Xsz4/P09SXYw/prvSvKzTKMfBv/obQZWt+XVwM0D9VVJTk2yFFgG3D4L4ztRdNePJCuAPwYuq6ofDazqrhcASZYNPLwMeKgtd9ePqrqvquZX1ZKqWsJ42L+8qr7LdPox2+9en8w34CZgD/Dj9gd1FfAzwBbg4XZ/1sD21zL+jvw24Ddme/wj6seb2vIBYC/wpR76MUkvtjM+V3t3u320h14cph+fBe4H7gU+DyzsuR8T1u+gXdUznX74lQ2S1BmneiSpMwa/JHXG4Jekzhj8ktQZg1+SOmPwS1JnDH5J6sz/AThW9c7HA6AiAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "nb/min/max : 10000 94 139\n"
     ]
    }
   ],
   "source": [
    "def plot_histo_graphs(dataset, title):\n",
    "    # histogram of graph sizes\n",
    "    graph_sizes = []\n",
    "    for graph in dataset:\n",
    "        graph_sizes.append(graph[0].number_of_nodes())\n",
    "        #graph_sizes.append(graph[0].number_of_edges())\n",
    "    plt.figure(1)\n",
    "    plt.hist(graph_sizes, bins=20)\n",
    "    plt.title(title)\n",
    "    plt.show()\n",
    "    graph_sizes = torch.Tensor(graph_sizes)\n",
    "    print('nb/min/max :',len(graph_sizes),graph_sizes.min().long().item(),graph_sizes.max().long().item())\n",
    "    \n",
    "plot_histo_graphs(dataset.train,'trainset')\n",
    "plot_histo_graphs(dataset.val,'valset')\n",
    "plot_histo_graphs(dataset.test,'testset')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "45000\n",
      "5000\n",
      "10000\n",
      "(DGLGraph(num_nodes=110, num_edges=880,\n",
      "         ndata_schemes={'feat': Scheme(shape=(5,), dtype=torch.float16)}\n",
      "         edata_schemes={'feat': Scheme(shape=(1,), dtype=torch.float16)}), tensor(6))\n",
      "(DGLGraph(num_nodes=123, num_edges=984,\n",
      "         ndata_schemes={'feat': Scheme(shape=(5,), dtype=torch.float16)}\n",
      "         edata_schemes={'feat': Scheme(shape=(1,), dtype=torch.float16)}), tensor(6))\n",
      "(DGLGraph(num_nodes=118, num_edges=944,\n",
      "         ndata_schemes={'feat': Scheme(shape=(5,), dtype=torch.float16)}\n",
      "         edata_schemes={'feat': Scheme(shape=(1,), dtype=torch.float16)}), tensor(3))\n"
     ]
    }
   ],
   "source": [
    "print(len(dataset.train))\n",
    "print(len(dataset.val))\n",
    "print(len(dataset.test))\n",
    "\n",
    "print(dataset.train[0])\n",
    "print(dataset.val[0])\n",
    "print(dataset.test[0])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Time (sec): 56.585689067840576\n"
     ]
    }
   ],
   "source": [
    "start = time.time()\n",
    "\n",
    "with open('data/superpixels/CIFAR10.pkl','wb') as f:\n",
    "        pickle.dump([dataset.train,dataset.val,dataset.test],f)\n",
    "        \n",
    "print('Time (sec):',time.time() - start) # 58s\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Test load function"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[I] Loading dataset CIFAR10...\n",
      "train, test, val sizes : 45000 5000 10000\n",
      "[I] Finished loading.\n",
      "[I] Data load time: 76.3279s\n"
     ]
    }
   ],
   "source": [
    "DATASET_NAME = 'CIFAR10'\n",
    "dataset = LoadData(DATASET_NAME) # 54s\n",
    "trainset, valset, testset = dataset.train, dataset.val, dataset.test\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Time (sec): 0.002046823501586914\n"
     ]
    }
   ],
   "source": [
    "start = time.time()\n",
    "\n",
    "batch_size = 10\n",
    "collate = SuperPixDataset.collate\n",
    "train_loader = DataLoader(trainset, batch_size=batch_size, shuffle=True, collate_fn=collate)\n",
    "\n",
    "print('Time (sec):',time.time() - start) # 0.0001s\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
